﻿@using System.Data;
@using Shop.Entity;
@using Shop.Help;
@using Shop.Bll;
@using Webdiyer.WebControls.Mvc
@using System.Web.Mvc.Ajax;
@model  PagedList<DataRow>
@{
    string actionString = RoleLogic.GetPowerStr("Article", ManagerLogic.GetLoginInfo().ManagerRoleGuid);
}
<table class="table table-bordered  table-condensed table-condensed  table-hover">
    <thead>
        <tr>
            <th>门店</th>
            <th>手机号</th>
            <th>短信内容</th>
            <th>条数</th>
            <th>发送时间</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var row in Model)
        {
            <tr>
                @if (row["Name"].ToString().Length >= 20)
                {
                    <td class="title" id="@row["Guid"]" onmouseover="ShowMsg('@row["Guid"]','@row["Name"]')">@row["Name"].ToString().Substring(0, 20)  ...</td>
                }
                else
                {
                    <td class="title">@row["Name"]</td>
                }
                @if (row["Mobiles"].ToString().Length >= 22)
                {

                    <td>

                        @(row["Mobiles"].ToString().Substring(0, 22)) ...

                    </td>
                }
                else
                {
                    <td>@row["Mobiles"]</td>
                }


                @if (row["SmsContent"].ToString().Length >= 50)
                {

                    <td>
                        <abbr data-toggle="popover" title="短信内容" data-trigger="hover" data-content="@row["SmsContent"]">
                            @(row["SmsContent"].ToString().Substring(0, 50)) ...
                        </abbr>
                    </td>
                }
                else
                {
                    <td>@row["SmsContent"]</td>
                }
                <td>@row["SmsCount"]</td>
                <td>@Convert.ToDateTime(row["SendTime"]).ToString("yyyy-MM-dd HH:mm")</td>
            </tr>
        }
    </tbody>
</table>
<input type="hidden" value="@Model.CurrentPageIndex" id="PageIndex" />
<div class="text-center">

    <ul class="pagination">
        <li>
            <span aria-hidden="true">
                @(Model.PageSize)条/页，@(Model.TotalPageCount)页, 共@(Model.TotalItemCount)条
            </span>
        </li>
        <li>
            <span aria-hidden="true">
                每页
                <select id="sendPageSize" onchange="SendPageSizeChange();" style="font-size: smaller;">
                    <option value="10">10</option>
                    <option value="15">15</option>
                    <option value="20">20</option>
                </select>
                条
            </span>
        </li>
    </ul>
    @Ajax.Pager(Model,
new PagerOptions
{
    PageIndexParameterName = "sendPageIndex",
    CssClass = "pagination",
    FirstPageText = "首页",
    LastPageText = "尾页",
    PrevPageText = "上一页",
    PageIndexBoxId = "sendPageIndexBox",

    NumericPagerItemCount = 5,
    NextPageText = "下一页",
    CurrentPagerItemTemplate = "<li class=\"active\"><a href=\"#\">{0}</a></li>",
    DisabledPagerItemTemplate = "<li class=\"disabled\"><a>{0}</a></li>",
    PagerItemTemplate = "<li>{0}</li>",
    AutoHide = false,

}, new MvcAjaxOptions
{
    UpdateTargetId = "SendTable",
    HttpMethod = "Post",
    DataFormId = "formSendSearch",
    EnableHistorySupport = false,
    OnSuccess = "SendSuccess();",
    EnablePartialLoading = true
}
)


    <ul class="pagination">
        <li>
            <span aria-hidden="true" style="padding: 2px 3px;">
                跳转到第<input id="sendPageIndexBox" class="form-control input-sm" style="border-radius:0px;width:auto;display:inline-block;" oninput="InputPageIndex(this);" />
                <button class="btn btn-primary btn-sm" id="goBuyBtn1" style="border-radius:0px;" onclick="GoPageIndex();">Go</button>
            </span>
        </li>
    </ul>

</div>
<script>
    $('[data-toggle="popover"]').popover();

    function SendSuccess()
    {
     
        $("#sendPageSize").val('@ViewData["sendPageSize"]');
    }

    function SendPageSizeChange()
    {
        $("input[name='sendPageSize']").val($("#sendPageSize").val());
        $("#formSendSearch").submit();
    }
</script>